﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form3 : Form
    {
        public Form3()
        {
            InitializeComponent();

            var resumenes = Bolseye.Support.ObtenerTodosLosResumenesTexto();

            var res = resumenes.OrderByDescending(r => r.TasaMensualDbl).ToList();

            resumenOperacionVerboseBindingSource.DataSource = res;


            foreach (var h in Bolseye.Support.ObtenerHistorialGananciaBruta(1))
            {
                chart1.Series[0].Points.AddXY(h.Fecha, h.PrecioCierre);
            }


            foreach (var h in Bolseye.Support.ObtenerHistorialSimbolo(3))
            {
                chart2.Series[0].Points.AddXY(h.Fecha, h.PrecioMax, h.PrecioMin, h.PrecioApertura, h.PrecioCierre);
            }



            chart1.ChartAreas.First().AxisY.LabelStyle.Format = "{0:$#,0.00}";
            chart2.ChartAreas.First().AxisY.LabelStyle.Format = "{0:$#,0.00}";
            chart2.Series[0]["PriceUpColor"] = "Green";
            chart2.Series[0]["PriceDownColor"] = "Red";
            //var ra = new Random();
            //var c = new List<Compo>();
            //for (var n = 0; n < 50; n++)
            //{
            //    var cc = new Compo
            //    {
            //        Fecha = DateTime.UtcNow.AddDays(-100).AddDays(n),
            //        Importe = ra.Next() + n
            //    };

            //    chart1.Series[0].Points.AddXY(cc.Fecha, cc.Importe);
            //}

            //chart1.Series[0].YValueType = 
            //    System.Windows.Forms.DataVisualization.Charting.ChartValueType.;

            


        }

        private class Compo
        {
            public DateTime Fecha;
            public float Importe;
        }

    }
}
